<template>
  <div class="active-province-box">
    <div class="select1">
      <AreaSelect></AreaSelect>
    </div>
    <ActiveTime></ActiveTime>
    <TabDatas></TabDatas>
    <DetailsDialog></DetailsDialog>
  </div>
</template>

<script>
import { Bus } from "../../Bus";
import { getactivedatas, queryactivitydatas } from "../../api/datas";
import AreaSelect from "../../components/sales/areaSelect";
import ActiveTime from "../../components/active/activeTime";
import TabDatas from "../../components/sales/TabDatas";
import DetailsDialog from "../../components/sales/DetailsDialog";
export default {
  components: {
    AreaSelect,
    ActiveTime,
    TabDatas,
    DetailsDialog,
  },
  data() {
    return {
      province: "",
      lists: [
        {
          name: "省",
          prop: "province",
        },
        {
          name: "总活跃度",
          prop: "active_value",
        },
      ],
      provindeActives: [],
      istabpane: false,
    };
  },
  mounted() {
    Bus.$on("areadatas", (value) => {
      this.province = value.province;
    });
    Bus.$emit("tab-lists", this.lists);
    Bus.$emit("istabpane", this.istabpane);
    this.activedatas();
  },
  methods: {
    activedatas() {
      getactivedatas({}).then((res) => {
        this.provindeActives = res.res;
        Bus.$emit("tab-datas", this.provindeActives);
      });
    },
    querydatas() {
      queryactivitydatas(
        { 
        province: this.province 
        },
        {
          year:"",
          month:"",
        }
        ).then((res) => {
        this.provindeActives = res.resoult;
        Bus.$emit("tab-datas", this.provindeActives);
      });
    },
  },
  watch: {
    province() {
      this.querydatas();
    },
  },
};
</script>
<style lang="less" scoped>
.active-province-box {
  padding-top: 30px;
}
.active-time {
  margin: 30px 0px 0px 30px;
}
.select1 {
  margin-right: 50px;
  margin-left: 30px;
}
</style>